import tkinter as tk

root = tk.Tk()
root.geometry('500x300+350+250')
root.title('复选框')
a = ['打篮球','踢足球','打毛球']
v = [tk.BooleanVar(),tk.BooleanVar(),tk.BooleanVar()]
for i in range(len(a)):
    check = tk.Checkbutton(root,text=a[i],variable=v[i])
    check.pack()
def check():
    for i in range(len(a)):
        if v[i].get()==True:
            print(a[i])
tijiao = tk.Button(root,text='提交',command=check)
tijiao.pack()



root.mainloop()